﻿using System;
using System.Linq;
using Domain.Entity;

namespace QQNumberForZoneCatchDao
{
    public class QqEmailDao
    {
        /// <summary>
        /// 添加QQEmail信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public static bool AddToQqEmail(QQEmail dto)
        {
            using (var db = new DBDataContext())
            {
                try
                {
                    if (!db.QQEmail.Any(x => x.Email == dto.Email))
                    {
                        db.QQEmail.InsertOnSubmit(dto);
                        db.SubmitChanges();
                    }
                    return true;
                }
                catch (Exception ex)
                {
                    throw new Exception("添加QQEmail信息失败", ex);
                }

            }

        }
    }
}
